<template>
  <el-form-item label="默认值">
    <el-input
      v-model="state.activeData._config_.defaultValue"
      :value="setDefaultValue(state.activeData._config_.defaultValue)"
      placeholder="请输入默认值"
      @change="onDefaultValueInput(state.activeData, state.activeData._config_.defaultValue)"
    />
  </el-form-item>
  <el-form-item label="高度">
    <el-input-number v-model="state.activeData.rows" placeholder="高度" :min="1"> </el-input-number>
  </el-form-item>
  <el-form-item label="最多输入">
    <el-input-number v-model="state.activeData.maxlength" placeholder="字符长度" :min="0"> </el-input-number>
  </el-form-item>
  <el-form-item label="显示标签">
    <el-switch v-model="state.activeData._config_.showLabel" />
  </el-form-item>
  <el-form-item label="输入统计">
    <el-switch v-model="state.activeData['show-word-limit']" />
  </el-form-item>
  <el-form-item label="是否密码">
    <el-switch v-model="state.activeData['show-password']" />
  </el-form-item>
  <el-form-item label="是否只读">
    <el-switch v-model="state.activeData.readonly" />
  </el-form-item>
  <el-form-item label="是否禁用">
    <el-switch v-model="state.activeData.disabled" />
  </el-form-item>
  <el-form-item label="是否隐藏">
    <el-switch v-model="state.activeData._config_.noShow" />
  </el-form-item>
  <el-form-item label="是否必填">
    <el-switch v-model="state.activeData._config_.required" />
  </el-form-item>
</template>
<script lang="ts" setup name="GoodTextArea">
import { onDefaultValueInput, setDefaultValue } from "./mixin";
const props = defineProps({
  activeData: {
    type: Object,
    default: null
  }
});
const state = reactive({
  activeData: {} as any
});
const propsData = toRef(props);
state.activeData = propsData.value.activeData;
const emits = defineEmits(["updateActiveData"]);
watch(
  () => state.activeData,
  val => {
    emits("updateActiveData", val);
  }
);
</script>
